<h2>Thêm Địa Điểm Vào Tour</h2>
<form name="add_location_for_tour_form" action="?act=save_locations_for_tour&tour_id=<?php echo $tour_id?>" method="POST">
<div>
	<label for="country">Quốc Gia:</label>
	<select name="country" id="country" onchange="load_location()">
		<?php
			$countries = Country::getAllCountries();
			foreach ($countries as $country)
				echo '<option value="'.$country->getid().'">'.$country->getname().'</option>';
		?>
	</select>
</div>	
<div>
	<label for="location">Địa Điểm:</label>
	<select name="location" id="location">
		<?php
			$tour = new Tour();
			$tour->select($tour_id);
			if ($tour) {
				$locations = $tour->getAllAvailableLocations();
				foreach ($locations as $location) 
					if ($location->getcountry() == 1) { // by default we load all location for the 1st country	
						echo '<option value="'.$location->getid().'">'.$location->getname().'</option>';
					}
			}
		?>
	</select>
</div>
<input type="submit" value="Save">
</form>
<script type="text/javascript">
	function load_location()
	{
		query = 'tour_id=<?php echo $tour_id?>&country_id='+$('#country').val()+'&act=load_locations_for_country';
		$.ajaxIt(query,'action.php', function(result){
			$("#location").html(result);
		});
	}
</script>